package com.teradyne.phoenix.client.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Widget;

public class ContentArea extends LayoutPanel implements AcceptsOneWidget {

	private static ContentAreaUiBinder uiBinder = GWT
			.create(ContentAreaUiBinder.class);

	interface ContentAreaUiBinder extends UiBinder<Widget, ContentArea> {
	}

	private IsWidget widget;

	public ContentArea() {
		uiBinder.createAndBindUi(this);
	}

	@Override
	public void setWidget(IsWidget w) {
		if (w == widget) {
			return;
		}
		if (widget != null) {
			super.remove(widget);
		}
		widget = w;
		if (w != null) {
			super.add(w);
		}
	}

}
